﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace SpaceInvaders
{
    public class Icon
    {
        public Texture2D texture { get; private set; }
        public Vector2 position;
        public Color color { get; private set; }
        //public bool draw;

        public Icon(Texture2D texture)
        {
            this.texture = texture;
            color = Color.White;
        }
        public Icon(Texture2D texture, Color color)
        {
            this.texture = texture;
            this.color = color;
        }
        public Icon(Texture2D texture, Vector2 position)
        {
            this.texture = texture;
            this.position = position;
            this.color = Color.White;
        }
        public Icon(Texture2D texture, Color color, Vector2 position)
        {
            this.texture = texture;
            this.color = color;
            this.position = position;
        }
        public Rectangle CollisionRect()
        {
            return new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height);
        }
        public bool CheckMouse(MouseState m)
        {
            if ((m.X >= position.X &&
               m.X <= position.X + texture.Width) &&
               (m.Y >= position.Y &&
               m.Y <= position.Y + texture.Height))
            {
                return true;
            }
            else
            {
                return false;
            }
           
        }
        public virtual void Draw(SpriteBatch spriteBatch)
        {
            if (position != null)
            {
                spriteBatch.Draw(texture, position, color);
            }
            else
            {
                throw (new Exception("Invalid Position")); // tá certo essa porra?
            }
        }


    }
}
